From 19c624b57a2a6c1af0e466d6888317138052105f Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 15 Apr 2009 11:25:07 +0100 Subject: [PATCH] xend: serialise domain restart threads I observed from xend.log that several domain restart threads run simultaneously. This patch make it singleton. Without this, several coredump of a domain might be created. Signed-off-by: Kouya Shimura --- tools/python/xen/xend/XendDomainInfo.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 720a1b7bb1..3fa2327272 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -350,6 +350,8 @@ class XendDomainInfo: @type shutdownWatch: xen.xend.xenstore.xswatch @ivar shutdownStartTime: UNIX Time when domain started shutting down. @type shutdownStartTime: float or None + @ivar restart_in_progress: Is a domain restart thread running? + @type restart_in_progress: bool # @ivar state: Domain state # @type state: enum(DOM_STATE_HALTED, DOM_STATE_RUNNING, ...) @ivar state_updated: lock for self.state @@ -418,6 +420,7 @@ class XendDomainInfo: self.shutdownWatch = None self.shutdownStartTime = None self._resume = resume + self.restart_in_progress = False self.state_updated = threading.Condition() self.refresh_shutdown_lock = threading.Condition() @@ -1929,7 +1932,8 @@ class XendDomainInfo: finally: self.refresh_shutdown_lock.release() - if restart_reason: + if restart_reason and not self.restart_in_progress: + self.restart_in_progress = True threading.Thread(target = self._maybeRestart, args = (restart_reason,)).start() -- 2.30.2